#-*- coding: utf-8 -*-
'''
Created on 2016年8月4日

@author: huanghaoyu
'''
from urllib2 import Request, urlopen

class HttpClient(object):
    '''
    Http client for CommandGateway
    '''

    @staticmethod
    def get_response_from_commandgateway(url, headers, data):
        request = Request(url = url, headers = headers, data = data.encode("utf-8"))
        response = urlopen(request)
        
        if response.getcode() != 200:
            raise Exception
        
        return response.read()
        
